package com.zxl.always.on.display.base;

import android.app.Fragment;
import android.os.Bundle;

/**
 * Created by Administrator on 2016/8/19.
 */
public class BaseFragment extends Fragment {

    private BackHandledInterface mBackHandledInterface;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getActivity() instanceof BackHandledInterface) {
            mBackHandledInterface = (BackHandledInterface) getActivity();
        }
    }

    @Override
    public void onStart() {
        super.onStart();
        if (null != mBackHandledInterface) {
            mBackHandledInterface.setSelectedFragment(this);
        }
    }

    /**
     * 返回事件
     * @return
     */
    public boolean onBackPressed() {
        return false;
    }

    /**
     * home键被单击
     */
    public void onHomeClick() {

    }


    public interface BackHandledInterface {

        void setSelectedFragment(BaseFragment selectedFragment);
    }

}
